<!DOCTYPE html>
<html>
<head>
    <title>Defining custom functions</title>
    <link rel="stylesheet" href="../../codebase/webix/webix.css" type="text/css" charset="utf-8">
    <script src="../../codebase/webix/webix.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="../../codebase//pivot.css" type="text/css" charset="utf-8">
    <script src="../../codebase/pivot.js" type="text/javascript" charset="utf-8"></script>


    <link rel="stylesheet" href="../common/samples.css" type="text/css" charset="utf-8">
    <script src="../common/testdata.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
    <div class='header_comment'>Defining custom functions</div>
    <div id="testA"></div>

    <style type="text/css">
    html, body {
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        }
    </style>

    <script type="text/javascript" charset="utf-8">

    webix.ready(function(){
        grida = webix.ui({
            container:"testA",
            id:"pivot",
            view:"pivot",
            height:400,
            width:1000,
            data:pivot_dataset,
            max: true,
            structure: {
                rows: ["form", "name"],
                columns: ["year"],
                values: [{ name:"gdp", operation:"sum"}, { name:"oil", operation:"sum"}]
            }
        });
        grida.operations.abssum = function(args) {
            var sum = 0;
            for (var i = 0; i < args.length; i++) {
                var arg = window.parseFloat(args[i], 10);
                if (!window.isNaN(arg))
                    sum += Math.abs(arg);
            }
            return sum;
        };
    });
    </script>
</body>
</html>